package com.itunion.ddd.application.item.command.query;

import com.itunion.ddd.application.item.converter.TbItemCategoryAppConverter;
import com.itunion.ddd.application.item.dto.clientobject.TbItemCategoryCO;
import com.itunion.ddd.infra.gateway.database.dataobject.TbItemCategoryDO;
import com.itunion.ddd.infra.gateway.database.mapper.TbItemCategoryMapper;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

@Component
public class TbItemCategoryGetQryExe {
    @Resource
    private TbItemCategoryMapper tbItemCategoryMapper;

    public TbItemCategoryCO execute(Long id){
        TbItemCategoryDO itemCategoryDO = tbItemCategoryMapper.selectById(id);
        if(itemCategoryDO == null){
            return null;
        }
        return TbItemCategoryAppConverter.toTbItemCategoryCO(itemCategoryDO);
    }

}
